#ifndef BAG_DEALER_SAMPLE_H
#define BAG_DEALER_SAMPLE_H

#include <string>
#include <list>
#include <openssl/md5.h>
#include <json/json.h>
#include <iostream>

namespace DS {

    class Sample {
    public:
        Sample() = default;
        Sample(const std::string& token,
               const long long& timestamp,
               const std::string& scene_token,
               const std::string& prev,
               const std::string& next = "");
        Sample(const Sample& sample);
        Sample(const Sample&& sample) noexcept;
        inline Sample& operator=(const Sample& rhs);
        Json::Value serialize();
        std::string get_prev();
        void set_next(const std::string& next);
        friend std::ostream& operator<<(std::ostream& out, const Sample& rhs);

    private:
        std::string token;
        long long timestamp;
        std::string scene_token;
        std::string prev;
        std::string next;
    };

    class SampleData {
    public:
        SampleData() = default;
        SampleData(const std::string token,
                   const std::string sample_token,
                   const std::string calibrated_sensro_token,
                   const std::string filename,
                   const std::string fileformat,
                   int width,
                   int height,
                   long long timestamp,
                   const std::string prev,
                   const std::string next = "");
        Json::Value serialize();
        friend std::ostream& operator<<(std::ostream& out, const SampleData& rhs);

    private:
        std::string token;
        std::string sample_token;
        std::string calibrated_sensor_token;
        std::string filename;
        std::string fileformat;
        int width;
        int height;
        long long timestamp;
        std::string prev;
        std::string next;
    };

    class SampleList{
    public:
        SampleList() = default;
        ~SampleList();
        void dump(const std::string& fName);
        std::list<Sample*> samples;
        std::list<SampleData*> sampledata;
    };

} // DS

#endif //BAG_DEALER_SAMPLE_H
